﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace XRpgLibrary.Logging
{
    public static class Log
    {
        public static void Error(string err, params object[] args)
        {
#if WINDOWS
            Output("err", err, args);
#endif
        }

        public static void Message(string err, params object[] args)
        {
#if WINDOWS
            Output("msg", err, args);
#endif
        }
        
        private static void Output(string type, string err, params object[] args)
        {
#if WINDOWS
            string msg = string.Format("<div class='{2}'>{0}: {1}</div>",
                           System.DateTime.Now.ToLongTimeString(),
                           string.Format(err, args),
                           type);

            using (StreamWriter textOut = new StreamWriter(new FileStream("log.html", FileMode.Append, FileAccess.Write)))
            {
                textOut.WriteLine(msg);
            } 
#endif
        }
    }
}
